import time

class FirstBase():
    """
    构造人类类
    """
    def __init__(self, NAME: str, AGE: int):
        self._name = NAME
        self._age = AGE

    @property
    def name(self):
        return self._name
    
    @property
    def age(self):
        return self._age
    
    def all_info(self):
        """
        返回所有信息 字典
        :::return: dict
        """
        return {
            "名字": self.name,
            "年龄": self.age
        }
    
class GirlBase():
    """
    构造女孩类
    """
    def __init__(self, BODY: str, COLOR: str):
        self._body = BODY
        self._color = COLOR

    @property
    def body(self):
        return self._body
    
    @property
    def color(self):
        return self._color
    
    def all_info(self):
        """
        返回所有信息 字典
        :::return: dict
        """
        return {
            "身材": self.body,
            "发色": self.color
        }
    
class Second(FirstBase, GirlBase):
    """
    赋予第二次意义类
    """
    def __init__(self, NAME: str, AGE: int, BODY: str, COLOR: str):
        FirstBase.__init__(self, NAME, AGE)
        GirlBase.__init__(self, BODY, COLOR)
        self._job = None
        self._thing = None

    @property
    def job(self):
        return self._job

    @job.setter
    def job(self, value: str):
        if not isinstance(value, str):
            raise TypeError(f"你输入的是啥？你自己看看：{value}, 输入的必须是字符串!")
        self._job = value

    @property
    def thing(self):
        return self._thing

    @thing.setter
    def thing(self, value: str):
        if not isinstance(value, str):
            raise TypeError(f"你输入的是啥？你自己看看：{value}, 输入的必须是字符串!")
        self._thing = value

    def all_info(self):
        first = FirstBase.all_info(self)
        girl = GirlBase.all_info(self)
        return {
            **first,
            **girl,
            "日常": self.thing if self.thing is not None else "未填写",
            "工作": self.job if self.job is not None  else "未填写",
        }

    def do_thing(self, thing: str):
        """
        ::: param thing: 要做的事情
        """
        self.thing = thing
        return {
            "身材": self._body,
            "发色": self._color,
            "日常": self.thing
        }
    
    def do_job(self, job: str):
        """
        ::: param job: 要做的工作
        """
        self.job = job
        return {
            "名字": self._name,
            "年龄": self._age,
            "工作": self.job
        }
    def print_class_name(self):
        """
        打印类名
        """
        return self.__class__.__name__
    
def UsingFirstBase():
    """
    使用FirstBase
    """
    first = FirstBase("Summer", 18)
    if first.age >= 18:
        print(f"{first.name} - {first.age}")
    else:
        time.sleep(10)
        print("error")

def UsingGirlBase():
    """
    测试GirlBase
    """
    girl = GirlBase("纤瘦", "紫色")
    print(f"{girl.body} - {girl.color}")

def UsingSecond():
    sec = Second(
        NAME = "Summer",
        AGE = 20, 
        BODY = "小",
        COLOR = "黑色"
        )

    if sec.age >= 18:
        print(f"【名字：{sec.name} - 年龄：{sec.age}】恭喜你，你已成年！")
    else:
        time.sleep(10)
        print("未成年，请稍等！")

    print("####################################")
    print(f"所有信息：{sec.all_info()}")

    sec.do_job("歌手")
    print(sec.job)
    sec.do_thing("跑步")
    print(sec.thing)

    print("####################################")
    print(f"所有信息：{sec.all_info()}")

    print(f"正在运行的模块名字：{sec.print_class_name()}")

def main():
    # UsingFirstBase()
    # UsingGirlBase()
    UsingSecond()


if __name__ == "__main__":
    main()